package ioperations;

import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LENOVO
 * Date: 2024-08-02
 * Time: 18:36
 */
public class FindOperation implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("您要查找的书籍名称：");
        Scanner scanner = new Scanner(System.in);
        String bookName = scanner.nextLine();
        for (int i = 0; i < bookList.usedSize; i++) {
            if(bookName.equals(bookList.books[i].getName())){
                System.out.println("找到了！");
                System.out.println(bookList.books[i]);
                return;
            }
        }
        System.out.println("很遗憾，书库里没有您要找的书！");
    }
}
